import service from '@/api/index.js';

export const getUsers = async (params) => {
  try {
    const res = await service.get('jestic-account-admin/v1/pt/admin/system/user/list', { params });
    return res;
  } catch (error) {
    throw error;
  }
};

export const searchSysUserInfoById = async (params) => {
  try {
    const res = await service.get('jestic-account-admin/v1/pt/admin/system/user/searchSysUserInfoById?userId=' + params);
    return res;
  } catch (error) {
    throw error;
  }
};

export const createUser = async (data) => {
  try {
    const res = await service.post('jestic-account-admin/v1/pt/admin/system/user/createUser', data);
    return res;
  } catch (error) {
    throw error;
  }
};

export const deleteUser = async (id) => {
  try {
    const res = await service.delete(`jestic-account-admin/v1/pt/admin/system/user/delete/${id}`);
    return res;
  } catch (error) {
    throw error;
  }
};

export const updateUserStatus = async (data) => {
  try {
    const res = await service.post('jestic-account-admin/v1/pt/admin/system/user/updateSysUserStatus', data);
    return res;
  } catch (error) {
    throw error;
  }
};

export const updateSysUserInfo = async (data) => {
  try {
    const res = await service.post('jestic-account-admin/v1/pt/admin/system/user/updateSysUserInfo', data);
    return res;
  } catch (error) {
    throw error;
  }
};

